-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blockstore: extract ARC cache from Bloom cache #3026
Conversation
it removes race condition that would happen during various calls License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
} | ||
} | ||
err := b.blockstore.PutMany(bs) | ||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd reverse the logic here to be more conventional:
if err != nil {
return err
}
for ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it was refactored out so there was more logic in here.
dd49a4e
to
a50495d
Compare
@Kubuxu theres a lot of failing tests here... |
} | ||
cachedbs.Put(b) | ||
|
||
cd.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats with locking here? you dont need to lock around a variable instantiation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah why is this lock here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The race detector was giving me an error otherwise for some reason, I can tinker with it more to find out the exact reason.
Maybe line 47 should be locked instead.
what was the actual race condition here that youre fixing? |
The race was happening when tests for ARC was running and the bloom cache finished initializing. The test failures you see here are because the gateways were down. |
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
a50495d
to
9543ed6
Compare
h, ok := b.arc.Get(k) | ||
if ok { | ||
return h.(bool), ok | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop the else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it is artefact from the refactor too
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
Alright, LGTM. waiting on tests to pass now |
All green. |
Also the race in question: https://gist.github.com/Kubuxu/575f39058618a3fd5fd3efa518c65c1e |
blockstore Blockstore | ||
} | ||
|
||
func arcCached(bs Blockstore, lruSize int) (*arccache, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newArcCacheDS
it removes race condition that would happen during various calls
If tests are ok, it is good for review.
License: MIT
Signed-off-by: Jakub Sztandera [email protected]